<?php
/**
 * Desc:
 * Author:Oven
 * Date: 2017/7/28
 */

class TagModel extends CscModel{
    public static function model( $className=__CLASS__ ) {
        return parent::model( $className );
    }

    static $_instance =null;
    public static function  create(){
        if(null=== self::$_instance){
            self::$_instance = new self;
        }
        return self::$_instance;
    }
    public function getDbConnection($db="tag") {
        return Yii::app()->$db;
    }

    public function tableName() {
        return '{{tag}}';
    }

    public function getKV($where = " 1=1 "){
        $list = $this->fetchAll($where,0,1000,"id DESC ");
        $data = [];
        foreach($list as $row){
            $data[$row["id"]] = $row["title"];
         }
        return $data;
    }
}